module nobk {
	export class scrolpanel extends egret.DisplayObjectContainer{
		private aaa:egret.Shape;
		private bbb:egret.TextField;
		private return:egret.Bitmap;
		private btnstart:egret.Bitmap;
		private nobaikuai:baikuai;
		private ccc:Main;
		private auther:egret.TextField;
		public constructor() {
			super();
			this.aaa=new egret.Shape();
			this.bbb=new egret.TextField();
			this.btnstart=new egret.Bitmap();
			this.btnstart=this.createBitmapByName("jx_png");
			this.btnstart.x=250;
			this.btnstart.y=350;
			this.btnstart.touchEnabled=true;
			this.return=this.createBitmapByName("back_png");
			this.return.x=250;
			this.return.y=450;
			this.return.touchEnabled=true;
			this.aaa.graphics.beginFill(0x999a98);
		    this.aaa.graphics.drawRect(0,0,640,800);
			this.aaa.graphics.endFill();
			this.bbb.width=640;
			this.bbb.textAlign="center";
		this.auther=new egret.TextField();
        this.auther.text="游戏制作者：Leo"
        this.auther.textColor=0x000000;
        this.auther.x=150;
        this.auther.y=1000;
			this.addChild(this.aaa);
			this.addChild(this.bbb)
			this.addChild(this.btnstart);
			this.addChild(this.return);
			this.addChild(this.auther);
			this.btnstart.addEventListener(egret.TouchEvent.TOUCH_TAP,this.start,this);
			this.return.addEventListener(egret.TouchEvent.TOUCH_TAP,this.back,this);
		}
	
	public  gameend(cj:number){
            this.bbb.text="\n游戏结束\n\n"+"您的得分为："+cj+"\n最高分为："+localStorage.getItem("scrol")
	 }
	 private start(){
		this.removeChild(this.aaa);
		this.removeChild(this.bbb);
		this.removeChild(this.btnstart);
		this.removeChild(this.return)
		this.removeChild(this.auther)
		this.btnstart.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.start,this);
	    this.return.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.back,this);
        this.addChild(this.nobaikuai=new baikuai);
		this.nobaikuai.starttimer();
	 }
	 private back(){
		 this.btnstart.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.start,this);
	    this.return.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.back,this);
           this.removeChild(this.aaa);
		this.removeChild(this.bbb);
		this.removeChild(this.btnstart);
		this.removeChild(this.return) 
		this.removeChild(this.auther)
		this.addChild(this.ccc=new Main)
	 }
	  private createBitmapByName(name: string): egret.Bitmap {
        let result = new egret.Bitmap();
        let texture: egret.Texture = RES.getRes(name);
        result.texture = texture;
        return result;
    }
	}
}